package com.hsy.swu.roomdb

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.hsy.swu.home.course.CourseModel

@Dao
interface CourseDao {
    @Insert
    fun insertAll(courseList: List<CourseModel>)

    @Query("DELETE FROM CourseModel WHERE account = :account")
    fun deleteAllByAccount(account: String)

    @Query("SELECT * FROM CourseModel WHERE account = :account")
    fun getAllByAccount(account: String): List<CourseModel>

    @Query("DELETE FROM CourseModel WHERE classification ='custom' AND courseName =:courseName")
    fun deleteCustomCourseByName(courseName: String)

    @Query("DELETE FROM CourseModel WHERE classification ='custom'")
    fun deleteAllCustomCourse()

    @Query("SELECT * FROM CourseModel WHERE classification ='custom'")
    fun getAllCustomCourse(): List<CourseModel>
}